import { http } from '@/http/http';
import {
  IGetFamilyMembersResponse,
  IAddFamilyMemberRequest,
  IAddFamilyMemberResponse,
  IUpdateFamilyMemberRequest,
  IUpdateFamilyMemberResponse,
  IDeleteFamilyMemberResponse
} from './types/family';

/**
 * 获取家庭成员列表
 */
export function getFamilyMembers() {
  return http.get<IGetFamilyMembersResponse>('/patient/mylist');
}

/**
 * 添加家庭成员
 */
export function addFamilyMember(data: IAddFamilyMemberRequest) {
  return http.post<IAddFamilyMemberResponse>('/patient/add', data);
}

/**
 * 更新家庭成员
 */
export function updateFamilyMember(data: IUpdateFamilyMemberRequest) {
  return http.put<IUpdateFamilyMemberResponse>('/patient/update', data);
}

/**
 * 删除家庭成员
 */
export function deleteFamilyMember(id: string) {
  return http.delete<IDeleteFamilyMemberResponse>(`/patient/del/${id}`);
}